from pydispatch import dispatcher

SIGNAL = 'my-first-signal'


def handle_event(sender,a):
    """Simple event handler"""
    print(a)
    print('Signal was sent by', sender)


dispatcher.connect(handle_event, signal=SIGNAL, sender=dispatcher.Any)

first_sender = object()
second_sender = {}


def main():
    dispatcher.send(signal=SIGNAL, sender=first_sender,a=1)
    dispatcher.send(signal=SIGNAL, sender=second_sender,a=4)

if __name__ == '__main__':
    main()